#!/usr/bin/python

import socket
SEND_BUF_SIZE = 54096
RECV_BUF_SIZE = 54096

def modify_buff_size():
	sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
	#get the size of send buffer
	bufsize = sock.getsockopt(socket.SOL_SOCKET,socket.SO_SNDBUF)
	print "buffer size is :", bufsize

	sock.setsockopt(socket.SOL_TCP,socket.TCP_NODELAY,1)
	sock.setsockopt(socket.SOL_SOCKET,socket.SO_SNDBUF,SEND_BUF_SIZE)
	sock.setsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF,RECV_BUF_SIZE)

	send_bufsize = sock.getsockopt(socket.SOL_SOCKET,socket.SO_SNDBUF)
	recv_bufsize = sock.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF)
	print "send buffer size is :", send_bufsize
	print "recv buffer size is :", recv_bufsize
	#this value is some strange, it is double than RECV_BUF_SIZE


if __name__== '__main__':
	modify_buff_size()
